let _this = null

function p1(_this) {
  console.log(_this, '&&&&&')
  let group1 = [],
    group2 = []
  if (_this.unlocking('0102010104')) {
    group1.push({
      col: 3,
      button: {
        type: 'text',
        title: '修改',
        click: () => {
          _this.changeOrganiza()
        }
      }
    })
  }
  if (_this.unlocking('0102010105')) {
    group1.push({
      col: 5,
      button: {
        type: 'text',
        title: '查看OA架构',
        click: () => {
          _this.checkOAOrganiza()
        }
      }
    })
  }
  if (_this.infoData.oaStatus != 5 && _this.infoData.oaStatus != 6 && _this.unlocking('0102010101')) {
    group2.push({
      col: 4,
      button: {
        type: 'text',
        title: '修改',
        click: () => {
          _this.editStatus()
        }
      }
    })
  }
  return [
    [
      {
        title: '案场所属',
        col: 12,
        group: [
          {
            title: '案场所属',
            col: 14,
            key: 'orgName',
            text: { tooltip: false }
          },
          ...group1
        ]
      },
      {
        title: '案场状态',
        col: 12,
        group: [
          {
            title: '案场状态',
            key: 'status',
            col: 4,
            text: {
              type: 'dict',
              key: 'buildStatus'
            }
          },
          ...group2
        ]
      }
    ]
  ]
}

function p2() {
  let opt = [
    {
      title: '主委',
      key: 'chairMan',
      col: 12,
      text: {
        lineClamp: 10,
        webkitBoxOrient: 'vertical',
        display: '-webkit-box',
        whiteSpace: 'inherit'
      }
    },
    {
      title: '专案',
      key: 'project',
      col: 12,
      text: {
        lineClamp: 10,
        webkitBoxOrient: 'vertical',
        display: '-webkit-box',
        whiteSpace: 'inherit'
      }
    }
  ]
  return opt
}

function p3() {
  let opt = [
    {
      title: '女专',
      key: 'womenCollege',
      col: 12,
      text: {
        lineClamp: 2,
        webkitBoxOrient: 'vertical',
        display: '-webkit-box',
        whiteSpace: 'inherit'
      }
    },
    {
      title: '所属城市',
      key: 'city',
      col: 12,
      text: { tooltip: false },
      data: {
        from: (info) => {
          return `${info.province ? info.province : '-'}${info.city ? '-' + info.city : ''}${
            info.area ? '-' + info.area : ''
          }${info.plate ? '-' + info.plate : ''}`
        }
      }
    }
  ]
  return opt
}

function p4() {
  let opt = [
    {
      title: '售楼处地址',
      key: 'address',
      col: 12,
      text: {}
    },
    {
      title: '售楼处电话',
      key: 'salesOfficePhone',
      col: 12,
      text: {}
    }
  ]
  return opt
}

function p5() {
  let opt = [
    {
      title: '详细地址',
      key: 'detailedAddress',
      col: 24,
      text: { tooltip: false }
    }
  ]
  return opt
}

function p6() {
  let opt = [
    {
      title: '预计开盘日期',
      key: 'expectedOpenTime',
      col: 12,
      text: { type: 'date' }
    },
    {
      title: '进场日期',
      key: 'enterDate',
      col: 12,
      text: {
        type: 'date'
      }
    }
  ]
  return opt
}

function p7() {
  let opt = [
    {
      title: '合作模式',
      key: 'cooperationMode',
      col: 12,
      text: {
        type: 'dict',
        key: 'cooperationModeAttrSort'
      }
    },
    {
      title: '代理费率',
      col: 12,
      text: {},
      data: {
        from: (info) => {
          return _this.$formatter.formatMinMax(info.agencyRateMin, info.agencyRateMax, '%')
        }
      }
    }
  ]
  return opt
}

function p8() {
  let opt = [
    {
      title: '开发商',
      key: 'developers',
      col: 12,
      text: {}
    },
    {
      title: '开发商简称',
      key: 'developerAbbreviation',
      col: 12,
      text: {}
    }
  ]
  return opt
}

function p9() {
  let opt = [
    {
      title: '是否有保证金',
      key: 'isSecurityFund',
      col: 12,
      text: {},
      data: {
        from: (info) => {
          return info.isSecurityFund != null ? (info.isSecurityFund ? '是' : '否') : '-'
        }
      }
    },
    {
      title: '保证金金额',
      key: 'securityFundMoney',
      col: 12,
      text: {}
    }
  ]
  return opt
}

function p10() {
  let opt = [
    {
      title: '项目接电规则',
      key: 'projectPowerConnectionRules',
      col: 12,
      text: {}
    },
    {
      title: '项目接待规则',
      key: 'projectReceptionRules',
      col: 12,
      text: {}
    }
  ]
  return opt
}

function p11() {
  let opt = [
    {
      title: '总货量(面积)',
      key: 'totalArea',
      col: 12,
      text: {
        type: 'number',
        unit: '㎡'
      }
    },
    {
      title: '总货值(价值)',
      key: 'totalPrice',
      col: 12,
      text: {
        type: 'number',
        unit: '亿元'
      }
    }
  ]
  return opt
}

function p12() {
  let opt = [
    {
      title: '单边货量(面积)',
      key: 'unitArea',
      col: 12,
      text: {
        type: 'number',
        unit: '㎡'
      }
    },
    {
      title: '单边货值(价值)',
      key: 'unitPrice',
      col: 12,
      text: {
        type: 'number',
        unit: '亿元'
      }
    }
  ]
  return opt
}

function options(vm) {
  _this = vm
  return [...p1(_this), p2(), p3(), p4(), p5(), p6(), p7(), p8(), p9(), p10(), p11(), p12()]
}

export default {
  options
}
